﻿using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Common;
using HumanManagement.BusinessObjects;
using HumanManagement.DataAccess;

namespace HumanManagement.BusinessLogic
{
	public class JobPositionDepartmentBL
	{

		#region ***** Init Methods ***** 
		JobPositionDepartmentDA objJobPositionDepartmentDA;
		public JobPositionDepartmentBL()
		{
			objJobPositionDepartmentDA = new JobPositionDepartmentDA();
		}
		#endregion

		#region ***** Get Methods ***** 
		/// <summary>
		/// Get JobPositionDepartment by id
		/// </summary>
		/// <param name="id">ID</param>
		/// <returns>JobPositionDepartment</returns>
		public JobPositionDepartment GetByID(int id)
		{
			return objJobPositionDepartmentDA.GetByID(id);
		}

		/// <summary>
		/// Get all of JobPositionDepartment
		/// </summary>
		/// <returns>List<<JobPositionDepartment>></returns>
		public List<JobPositionDepartment> GetList()
		{
			string cacheName = "lstJobPositionDepartment";
			if( ServerCache.Get(cacheName) == null )
			{
				ServerCache.Insert(cacheName, objJobPositionDepartmentDA.GetList(), "JobPositionDepartment");
			}
			return (List<JobPositionDepartment>) ServerCache.Get(cacheName);
		}

		/// <summary>
		/// Get DataSet of JobPositionDepartment
		/// </summary>
		/// <returns>DataSet</returns>
		public DataSet GetDataSet()
		{
			string cacheName = "dsJobPositionDepartment";
			if( ServerCache.Get(cacheName) == null )
			{
				ServerCache.Insert(cacheName, objJobPositionDepartmentDA.GetDataSet(), "JobPositionDepartment");
			}
			return (DataSet) ServerCache.Get(cacheName);
		}


		/// <summary>
		/// Get all of JobPositionDepartment paged
		/// </summary>
		/// <param name="recperpage">recperpage</param>
		/// <param name="pageindex">pageindex</param>
		/// <returns>List<<JobPositionDepartment>></returns>
		public List<JobPositionDepartment> GetListPaged(int recperpage, int pageindex)
		{
			return objJobPositionDepartmentDA.GetListPaged(recperpage, pageindex);
		}

		/// <summary>
		/// Get DataSet of JobPositionDepartment paged
		/// </summary>
		/// <param name="recperpage">recperpage</param>
		/// <param name="pageindex">pageindex</param>
		/// <returns>DataSet</returns>
		public DataSet GetDataSetPaged(int recperpage, int pageindex)
		{
			return objJobPositionDepartmentDA.GetDataSetPaged(recperpage, pageindex);
		}





		#endregion

		#region ***** Add Update Delete Methods ***** 
		/// <summary>
		/// Add a new JobPositionDepartment within JobPositionDepartment database table
		/// </summary>
		/// <param name="obj_jobpositiondepartment">JobPositionDepartment</param>
		/// <returns>key of table</returns>
		public int Add(JobPositionDepartment obj_jobpositiondepartment)
		{
			ServerCache.Remove("JobPositionDepartment", true);
			return objJobPositionDepartmentDA.Add(obj_jobpositiondepartment);
		}

		/// <summary>
		/// updates the specified JobPositionDepartment
		/// </summary>
		/// <param name="obj_jobpositiondepartment">JobPositionDepartment</param>
		/// <returns></returns>
		public void Update(JobPositionDepartment obj_jobpositiondepartment)
		{
			ServerCache.Remove("JobPositionDepartment", true);
			objJobPositionDepartmentDA.Update(obj_jobpositiondepartment);
		}

		/// <summary>
		/// Delete the specified JobPositionDepartment
		/// </summary>
		/// <param name="id">ID</param>
		/// <returns></returns>
		public void Delete(int id)
		{
			ServerCache.Remove("JobPositionDepartment", true);
			objJobPositionDepartmentDA.Delete(id);
		}
		#endregion
	}
}
